﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Semantics.IR
{
    public class GraphUtility
    {
        public static Node ResolveOrCreate(Graph graph, Node src)
        {
            Node exist = graph.ResolveNode(src);
            if (exist == null)
            {
                Node newnode = new Node(src.Value);
                graph.EnrollNode(newnode);
                return newnode;
            }
            else
                return exist;
        }
    }
}
